package com.ws.test02;

/**
 * @author 王硕
 * @version jdk21
 * @className TestAInterface
 * @description
 * @date 2024/11/22 15:35
 */
public class TestAInterface {
    public static void main(String[] args) {
        AInterface anonymousClassImpl = new AInterface() {
            @Override
            public int sum(int a, int b) {
                return a + b;
            }
        };
        int resultAnonymous = anonymousClassImpl.sum(5, 3);
        System.out.println("结果（匿名内部类）: " + resultAnonymous);
        AInterface lambdaImpl = (a, b) -> a + b;
        int resultLambda = lambdaImpl.sum(5, 4);
        System.out.println("结果（Lambda表达式）: " + resultLambda);
    }
}
